Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

Use the new Format API #159

Merged
merged 7 commits into from
May 26, 2020
Merged

Use the new Format API #159

merged 7 commits into from
May 26, 2020

Conversation

mickael-menu
Copy link
Member

@mickael-menu mickael-menu marked this pull request as ready for review April 28, 2020 06:18
@@ -118,7 +118,7 @@ final class CBCDRMInputStream: DRMInputStream {
}

// TODO: Double check if there is a different way to remove padding from HTML resources only.
if (link.type == "application/xhtml+xml") {
if link.mediaType?.isHTML == true {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will also match text/html now.

public static let mimetype = "application/vnd.comicbook+zip"
}

public enum MediaType: String {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By replacing this with Format.of() and checking format.mediaType.isBitmap, we are supporting much more formats in a CBZ.

@@ -60,15 +56,17 @@ public final class PDFParser: PublicationParser, Loggable {
/// - Returns: The Resulting publication, and a callback for parsing the possibly DRM encrypted metadata in the publication, once the DRM object is filled by a DRM module (eg. LCP).
/// - Throws: `PDFParserError`
public static func parse(at url: URL, parserType: PDFFileParser.Type) throws -> (PubBox, PubParsingCallback) {
guard FileManager.default.fileExists(atPath: url.path) else {
guard FileManager.default.fileExists(atPath: url.path),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we can open a PDF even if it doesn't have a file extension.

@mickael-menu mickael-menu merged commit cfb0d8c into develop May 26, 2020
@mickael-menu mickael-menu deleted the feature/format-api branch May 26, 2020 07:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant